<html>
<head>
<title>ESRI File Geodatabase (OpenFileGDB)</title>
</head>

<body bgcolor="#ffffff">

<h1>ESRI File Geodatabase (OpenFileGDB)</h1>

<p>(Available in GDAL &gt;= 1.11)</p>

<p>
The OpenFileGDB driver provides read access to File Geodatabases
(.gdb directories) created by ArcGIS 9 and above.
</p>
<p>
It can also read directly zipped .gdb directories (.gdb.zip)
</p>
<p>
A specific .gdbtable file (including "system" tables) can also be opened
directly.
</p>

<h2>Spatial filtering</h2>

The driver cannot use the .spx files (when they are present) for spatial
filtering. However, it will use the minimum bounding rectangle included at the
beginning of the geometry blobs to speed up spatial filtering. By default, it
will also build on the fly a in-memory spatial index during the first sequential
read of a layer. Following spatial filtering operations on that layer will then
benefit from that spatial index. The building of this in-memory spatial index
can be disabled by setting the OPENFILEGDB_IN_MEMORY_SPI configuration option to
NO.

<h2>SQL support</h2>

SQL statements are run through the OGR SQL engine. When attribute indexes (.atx
files) exist, the driver will use them to speed up WHERE clauses or SetAttributeFilter()
calls.

<h3>Special SQL requests</h3>

"GetLayerDefinition a_layer_name" and "GetLayerMetadata a_layer_name" can be
used as special SQL requests to get respectively the definition and metadata of
a FileGDB table as XML content (only available in Geodatabases created with
ArcGIS 10 or above)

<h2>Comparison with the FileGDB driver</h2>

<p>
(Comparison done with a FileGDB driver using FileGDB API SDK 1.3)
</p>

<p>
Advantages of the OpenFileGDB driver:
</p>

<ul>
<li>Can read ArcGIS 9.X Geodatabases, and not only 10 or above.</li>
<li>Can open layers with any spatial reference system.</li>
<li>Thread-safe (i.e. datasources can be processed in parallel).</li>
<li>Uses the VSI Virtual File API, enabling the user
    to read a Geodatabase in a ZIP file or stored on a HTTP server.</li>
<li>Faster on databases with a big number of fields.</li>
<li>Does not depend on a third-party library.</li>
<li>Robust against corrupted Geodatabase files.</li>
</ul>

<p>
Drawbacks of the OpenFileGDB driver:
</p>

<ul>
<li>Read-only.</li>
<li>Cannot use spatial indexes.</li>
<li>Cannot read data from compressed feature classes (SDC, Smart Data Compression). Nor can can FileGDB driver because the ESRI FileGDB SDK lacks also this feature.</li>
</ul>

<h2>Examples</h2>

<ul>
    <li>Read layer from FileGDB and load into PostGIS:<p>
    <code>ogr2ogr -overwrite -f "PostgreSQL" PG:"host=myhost user=myuser dbname=mydb password=mypass" "C:\somefolder\BigFileGDB.gdb" "MyFeatureClass"</code>
    </li>
    <li>Get detailed info for FileGDB:<p>
    <code>ogrinfo -al "C:\somefolder\MyGDB.gdb"</code>
    </li>
    <li>Get detailed info for a zipped FileGDB:<p>
    <code>ogrinfo -al "C:\somefolder\MyGDB.gdb.zip"</code>
    </li>
</ul>

<h2>Links</h2>

<ul>
<li><a href="drv_filegdb.html">FileGDB driver</a>, relying on the FileGDB API SDK</li>
<li>Reverse-engineered specification of the <a href="https://github.com/rouault/dump_gdbtable/wiki/FGDB-Spec">FileGDB format</a></li>
</ul>

</body>
</html>
